﻿namespace Vdc.Grid
{
    using System;
    using System.ComponentModel;
    using System.Web.UI;

    [ToolboxData("<{0}:Grid runat=server></{0}:Grid>"), PersistChildren(false), ToolboxItem(false), ParseChildren(true)]
    public class GridRuntimeTemplate : GridTemplate
    {
        private RuntimeTemplate _template;

        protected override ITemplate GetTemplate()
        {
            return this.Template;
        }

        internal void InstantiateTemplate()
        {
            this.EnsureChildControls();
        }

        protected override void SetTemplate(ITemplate template)
        {
            this.Template = template as RuntimeTemplate;
        }

        [Description("The template."), DefaultValue((string) null), NotifyParentProperty(true), PersistenceMode(PersistenceMode.InnerDefaultProperty), DesignerSerializationVisibility(DesignerSerializationVisibility.Content), Browsable(false), TemplateContainer(typeof(TemplateContainer))]
        public RuntimeTemplate Template
        {
            get
            {
                return this._template;
            }
            set
            {
                this._template = value;
            }
        }
    }
}

